from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button

class MyApp(App):
    def build(self):
        # 创建一个垂直布局
        layout = BoxLayout(orientation='vertical', spacing=10, padding=10)

        # 添加输入框
        self.text_input = TextInput(hint_text='Enter text here', multiline=False)
        layout.add_widget(self.text_input)

        # 添加按钮
        button = Button(text='Submit')
        button.bind(on_press=self.on_button_click)
        layout.add_widget(button)

        return layout

    def on_button_click(self, instance):
        print("User entered:", self.text_input.text)

if __name__ == '__main__':
    MyApp().run()